package at.umit.biomed.actionpotential.computation;

import com.javable.cese.templates.AbstractAPModel;
import models.com.javable.cese.models.*;

public class ActionPotential<T extends AbstractAPModel> {

	protected T model;

	public double excitationTimeInMS = 0d;

	public ActionPotential(T model) {
		this.model = model;
	}

	public double getExcitationTimeInMS() {
		return this.excitationTimeInMS;
	}

	public double performAPTimeStep() {
		model.doSimulate();
		excitationTimeInMS += model.getdt();

		return model.getv();
	}

	public T getModel() {
		return model;
	}

	public void setModel(T model) {
		this.model = model;
	}

	public static void main(String... strings) {
		ActionPotential<FaberRudyModel_I_2007> mod = new ActionPotential<FaberRudyModel_I_2007>(
				new FaberRudyModel_I_2007());

		boolean x = true;
		for (int i = 1; i <= 300; i++) {
			double r = mod.performAPTimeStep();
			System.out.println(r + " "
					+ mod.getExcitationTimeInMS());

	
			
	
		}
	}

}
